package com.rk.puzzles;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

public class Glommer { 
	 String glom(Collection<?> objs) { 
	 String result = ""; 
	 for (Object o : objs) 
	 result += o; 
	 return result; 
	 } 
	 int glom(List<Integer> ints) { 
	 int result = 0; 
	 for (int i : ints) 
	 result += i; 
	 return result; 
	 } 
	 public static void main(String args[]) throws IOException { 
	 List<String> strings = Arrays.asList("1", "2", "3"); 
	 System.out.println(new Glommer().glom(strings)); 
	 
	 
	 //
	 
	 Set<String> set = new TreeSet<String>();
	 String path ="C:\\Users\\ravipatr\\Desktop\\BKP_DESKTOP\\helpdesk.txt";
	 BufferedReader br = new BufferedReader(new FileReader(path));
	 
		String str = null;
		int count = 0;
		while ((str = br.readLine()) != null) {
			String[] strArr = str.split("\\s");
			for(String word : strArr){
				if(word != null && !word.trim().equals("")){
					set.add(word);
					count++;
				}
				
			}
			
		}
	 
	 	
	 	
		System.out.println(set.toString());
		System.out.println("total words"+count);
		System.out.println("unique words"+set.size());
	 
	 } 
} 